cmake_minimum_required(VERSION 3.8)
project(agv_peripheral_controller)

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(action_msgs REQUIRED) 

find_package(agv_srvs REQUIRED)
find_package(agv_actions REQUIRED)
find_package(controller_manager_msgs REQUIRED)
find_package(chassis_controller REQUIRED)
find_package(modbus REQUIRED)
find_package(common REQUIRED)

find_package(yaml-cpp REQUIRED)
find_package(transform REQUIRED)
find_package(shared_parameters REQUIRED)
find_package(Boost REQUIRED COMPONENTS system)

add_compile_options(-std=c++17)
set(CMAKE_CXX_STANDARD 17)

include_directories(
  include
)


function(complite_executable target_name)
    add_executable(${target_name} ${ARGN})

    target_include_directories(${target_name} PRIVATE
      ${YAML_CPP_INCLUDE_DIR}
    )

    target_link_libraries(${target_name}
      yaml-cpp
    )

    ament_target_dependencies(${target_name}
        rclcpp
        std_msgs
        geometry_msgs
        sensor_msgs
        tf2_ros
        action_msgs
        controller_manager_msgs
        agv_srvs
        agv_actions
        chassis_controller
        modbus
        common
        yaml-cpp
        transform
        shared_parameters
    )
    
    install(TARGETS ${target_name}
        DESTINATION lib/${PROJECT_NAME}
    )
endfunction()

complite_executable(${PROJECT_NAME}_node src/amr/peripheral.cpp src/amr/pallet_controller.cpp)
#complite_executable(${PROJECT_NAME}_fork_node src/fork/peripheral_fork.cpp src/fork/fork_controller.cpp)
#complite_executable(${PROJECT_NAME}_lift_node src/ioLift/peripheral_lift.cpp src/ioLift/io_lifter_controller.cpp)
#complite_executable(${PROJECT_NAME}_lift_double_steer_node src/ioLiftDoubleSteer/peripheral_lift.cpp src/ioLiftDoubleSteer/io_lifter_controller.cpp)
#complite_executable(two_diff_lift_node src/ioLift/two_diff_peripheral_lift.cpp src/ioLift/two_diff_io_lifter_controller.cpp)
#complite_executable(${PROJECT_NAME}_two_jacking_node src/multiJack/peripheral_two_jacking.cpp)
#complite_executable(${PROJECT_NAME}_multi_jacking_node src/multiJack/peripheral_multi_jacking.cpp)
#complite_executable(peripheral_controller_roller_node 
#    src/roller/barrier_control.cpp 
#    src/roller/io_lift.cpp 
#    src/roller/motor_control.cpp 
#    src/roller/peripheral_roller.cpp 
#    src/roller/roller_controller.cpp 
#    src/roller/roller_signal.cpp)
#complite_executable(${PROJECT_NAME}_third_party_node src/third_party/peripheral_third_party.cpp src/third_party/actuator.cpp)
#complite_executable(${PROJECT_NAME}_catl_node src/third_party_catl/peripheral_catl.cpp)
#complite_executable(manual_peripheral_node src/ioLift/manual_lift.cpp)
#complite_executable(${PROJECT_NAME}_hydraulic_jacking_node src/hydraulicJack/peripheral_hydraulic_jacking.cpp)

install(DIRECTORY launch/
    DESTINATION share/${PROJECT_NAME}/launch
)

ament_export_dependencies(
    rclcpp
    std_msgs
    geometry_msgs
    sensor_msgs
    tf2_ros
    action_msgs
    controller_manager_msgs
    agv_srvs
    agv_actions
    chassis_controller
    modbus
    common
    yaml-cpp
)

ament_package()